package moa.learners;

import java.util.StringTokenizer;

import moa.MOAObject;
import moa.core.Measurement;
import moa.core.StringUtils;
import moa.learners.prefix.Item;
import moa.learners.prefix.Itemset;
import moa.options.IntOption;
import weka.core.Instance;
import weka.core.Instances;

public class ShowDataSpams extends AbstractLearner{

	protected Instances data;
	
	public IntOption nbInstanceOption = new IntOption("NumberOfInstances", 'n',
			"Number of instance to show (Max 20).", 5, 1,
			1000);
	
	@Override
	public void getModelDescription(StringBuilder out, int indent) {
		// TODO Auto-generated method stub
		out.append("The Data\n");
		out.append(data);
		StringUtils.appendNewline(out);
	}

	@Override
	protected Measurement[] getModelMeasurementsImpl() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void resetLearningImpl() {
		// TODO Auto-generated method stub
		
	}
	protected int nbCustomers = 0;
	
	
	@Override
	public void trainOnInstanceImpl(Instance inst) {
		String str;
		int transactionDate = 1;
		int item;
		nbCustomers ++;
		System.out.print(nbCustomers + " " + transactionDate);
		String speech = inst.toString();
		speech = speech.substring(1, speech.length()-1);
		StringTokenizer st = new StringTokenizer(speech);
		while (st.hasMoreTokens()) {
			str = st.nextToken();
			if (str.equals("-1"))
			{	
				System.out.println();
				 transactionDate ++;
				if (st.hasMoreTokens())
					System.out.print(nbCustomers + " " + transactionDate);
				//sequence.addItemset(itemset);
				//itemset = new Itemset();
			}	
			else
			{	
				// extract the value for an item
				Item it = new Item(Integer.parseInt(str));
				System.out.print(" " + it.getId());
				
			}	
		}
	}


	@Override
	public MOAObject getModel() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean isRandomizable() {
		// TODO Auto-generated method stub
		return false;
	} 

}